package com.blue.Impl.system;

import com.alibaba.fastjson.JSON;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.blue.mapper.system.ErrorLogsMapper;
import com.blue.po.system.ErrorLogsPO;
import com.blue.service.system.IErrorLogsService;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;


@Service
public class ErrorLogsServiceImpl extends ServiceImpl<ErrorLogsMapper, ErrorLogsPO> implements IErrorLogsService {

    @RabbitListener(queues = "errorLogsQueue")
    public void ErrorLogsListener(String content) {
        ErrorLogsPO errorLogsPO = JSON.parseObject(content, ErrorLogsPO.class);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        errorLogsPO.setDate(format.format(new Date()));
        this.save(errorLogsPO);
    }
}
